const { override, adjustStyleLoaders, addWebpackAlias, overrideDevServer, watchAll, disableEsLint, } = require("customize-cra");
const path = require("path");
module.exports = {
    webpack: override(
        // ...其他配置...
        adjustStyleLoaders(rule => {
            if (rule.test.toString().includes("scss")) {
                rule.use.push({
                    loader: require.resolve("sass-resources-loader"),
                    options: {
                        resources: "./src/assets/scss/index.scss" //这里是你自己放公共scss变量的路径
                    }
                });
            }
        }),
        addWebpackAlias({
            "@": path.resolve(__dirname, "src")
        }),
        disableEsLint()
    ),
    devServer: overrideDevServer(
        // dev server plugin
        // (() => {
        //     return {
        //         proxy: {
        //             '/api': {
        //                 target: 'https://test2.b-ymedia.com', // 线上测试
        //                 changeOrigin: true,
        //                 pathRewrite: {
        //                     '^/api': '' // 重写路径：去掉路径中开头的 '/api'
        //                 }
        //             },
        //         }
        //     }
        // })(),
        watchAll(),
    )
}



